package com.zy.storage.doc

import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update

@Dao
interface DocInfoDao {
    @Query("SELECT * FROM doc")
    fun getAll(): List<DocInfo>

    @Query("SELECT * FROM doc")
    fun getAllLiveData(): LiveData<List<DocInfo>>

    @Query("SELECT * FROM doc WHERE parentId = :parentId")
    fun getAllLiveData(parentId: Long): LiveData<List<DocInfo>>

    @Query("SELECT * FROM doc WHERE fileId = :fileId")
    fun getDocInfo(fileId: Long): LiveData<DocInfo>

    @Insert
    fun insertAll(vararg docInfoS: DocInfo)

    @Update
    fun update(docInfo: DocInfo)

    @Delete
    fun delete(user: DocInfo)
}